package cn.edu.ujn.finallab.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.edu.ujn.finallab.dao.Admin;
import cn.edu.ujn.finallab.dao.AdminMapper;
@Service
@Transactional
public class AdminServiceImpl implements IAdminService {

	@Autowired
	private AdminMapper adminMapper;
	
	@Override
	public Admin selectAdminByName(String name) {
		// TODO Auto-generated method stub
		Admin admin = this.adminMapper.selectByName(name);
		return admin;
	}

	@Override
	public List<Admin> selectAllAdmin() {
		// TODO Auto-generated method stub
		List<Admin> allAdmin = this.adminMapper.selectAllAdmin();
		return allAdmin;
	}

	@Override
	public int insertAdmin(Admin admin) {
		// TODO Auto-generated method stub
		int insert = this.adminMapper.insert(admin);
		return insert;
	}

	@Override
	public int deletAdmin(int id) {
		// TODO Auto-generated method stub
		int delete = this.adminMapper.deleteByPrimaryKey(id);
		return delete;
	}

	@Override
	public int updateAdmin(Admin admin) {
		// TODO Auto-generated method stub
		int i = this.adminMapper.updateByPrimaryKey(admin);
		return i;
	}

}
